Skip to content

support keyboard parameter modification#31

Open
QiuShuiBai wants to merge 4 commits intoLeaVerou:gh-pagesfrom
QiuShuiBai:gh-pages
Open

support keyboard parameter modification#31
QiuShuiBai wants to merge 4 commits intoLeaVerou:gh-pagesfrom
QiuShuiBai:gh-pages

Conversation

@QiuShuiBai
Copy link
Copy Markdown

Just like this

image

Copy link
Copy Markdown
Owner

@LeaVerou LeaVerou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks for contributing! Huge +1 on the functionality, I’ve wanted this myself as well!

Wrt implementation, I don’t think we actually need contentEditable here and it introduces a lot of complexity. I can see two solutions:

  1. Use separate <input type=number> elements and just apply the right text colors. Then you get the step behavior for free and you only need to code any modifiers.
  2. Use a single input for all four numbers, and use the CSS Custom Highlight API to apply the colors.

I’m fine with both, up to you!

@QiuShuiBai
Copy link
Copy Markdown
Author

Hi, I'm sorry for changing this only now. Currently Use separate elements to implement.

Please review : )

@LeaVerou
Copy link
Copy Markdown
Owner

No worries, thanks for working on it! I still see a lot of the old code however?

Comment thread contenteditable.js
var inputList = $$('.param');
var hiddenTextList = $$('.hidden-text');
function onInput(input, index) {
hiddenTextList[index].innerHTML = input.value || 0;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to update the hidden text to get the correct width

Comment thread contenteditable.js
}
function onKeydown(event, input) {
if (event.key === '-' && input.value[0] === '-') {
event.preventDefault();
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prevent adding another minus sign because when there are two minus signs, the value of becomes an empty string.

Comment thread contenteditable.js
}

function onBlur(input, index) {
var xy = input.value;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update Bezier curve

@QiuShuiBai
Copy link
Copy Markdown
Author

No worries, thanks for working on it! I still see a lot of the old code however?

The contenteditable.js file is required, and I’ve added a comment in the diff to explain it.

@QiuShuiBai QiuShuiBai requested a review from LeaVerou March 3, 2025 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants